#include <stdio.h>
#include <stdlib.h>
#include <time.h>

enum{ len = 12 };

void func(void){
    char id[len];
    int r;
    int num;
    /* ... */
    struct timespec ts;
    if (timespec_get(&ts,TIME_UTC)==0){
        /* Handle error */
    }
    srandom(ts.tv_nsec ^ ts.tv_sec);
    r=random();
    num = snprintf(id,len,"ID %d",r);
    /* ... */
}